<script setup>
import { articleDelete, artileDeleteChannel } from '@/api/article'
const emit = defineEmits(['success', 'delete'])
const open = (row, detail) => {
  if (!detail) {
    ElMessageBox.confirm('你确定要删除吗', '温馨提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',
    })
      .then(async () => {
        await artileDeleteChannel(row.id)
        ElMessage.success('删除成功')
        emit('success')
      })
      .catch(() => {})
  } else {
    ElMessageBox.confirm('你确定要删除吗', '温馨提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',
    })
      .then(async () => {
        console.log(row)

        await articleDelete(row.id)
        ElMessage.success('删除成功')
        emit('delete')
      })
      .catch(() => {})
  }
}

defineExpose({
  open,
})
</script>
<template></template>
